home *** CD-ROM | disk | FTP | other *** search
- /*================================================================================ */
- /* ScIntf.c - C Interface declaration to the Scanner Driver Interface Library */
- /* */
- /* Written by Tad Browne, PSAP Created: 20-FEB-88 */
- /* */
- /* Copyright Apple Computer, 1988,1989,1990 */
- /*_____________________________________________________________________________ */
- /* */
- /* Modification History: */
- /* */
- /* 15-OCT-89 - Tad Browne *)
- /* Added new definitions to support Apple 8-bit Scanner: */
- /* 1) Changed Reserved field of ScCompRec to startResolution and */
- /* endResolution to support resolutions in 1 dpi increments */
- /* 2) Changed downLoadFlags in scAdvFeaturesRec to downLoadStart, */
- /* downLoadEnd, and downLoadFlags to support download patterns */
- /* other than square, and sizes up to 127 X 127; */
- /* 02-APR-90 - Tad Browne *)
- /* Added new advanced feature: ScSetFastMode (Fast Scan Mode) */
- /* 03-APR-90 - Tad Browne *)
- /* Added new advanced feature: ScVendorUnique (Carriage Position) */
- /* 14-OCT-90 - Tad Browne *)
- /* Added ScSetLed, ScResetButton, ScGetButton, ScSetNoCal calls */
- /* 12-NOV-90 - Tad Browne *)
- /* Changed ScSetFastMode to ScSetSpeed, added new constants for ScSetSpeed */
- /* Added constants for Vendor Unique Parameter Types */
- /* VERSION 2.0a11 (for driver version 2.0a11-12) */
- /* 24-APR-1991 - Bill Houston */
- /* fixed advanced constants, added version reference to driver */
- /* VERSION 2.0a13 (for driver version 2.0a13) */
- /* 9-MAY-1991 - Bill Houston */
- /* changed a char to Boolean in ScGetButton */
- /* 9-Dec-91 - Steve Bischoff */
- /* Added scFullColor,scBiLevelColor */
- /* */
- /*============================================================================== */
-
-
- /* Standard Constants */
-
- #define scLineArt 0 /* Line Art Composition */
- #define scHalfTone 1 /* HalfTone Composition */
- #define scGrayScale 2 /* Gray Scale Composition */
- #define scBiLevelColor 3 /* BiLevel RGB Color Composition */
- #define scFullColor 4 /* Full Color Composition */
-
-
- /* Standard Data Types */
-
- typedef struct {
- unsigned char brightnessRange; /* NEW 2.0 */
- unsigned char contrastRange; /* NEW 2.0 */
- unsigned char reserved; /* NEW 2.0 */
- unsigned char resFlags; /* NEW 2.0 */
- short resElements;
- short halfToneElements;
- short brightnessMax;
- short contrastMax;
- long bitsPerPixel;
- short minReadSize;
- } ScCompRec;
-
- typedef struct {
- ResType scannerType;
- short version;
- short scanWidthNum;
- short scanWidthDen;
- short scanLengthNum;
- short scanLengthDen;
- ScCompRec composition[scFullColor+1];
- } ScStdFeaturesRec;
-
- typedef ScStdFeaturesRec *ScStdFeaturesPtr ;
-
- typedef short ScResArray[1];
- typedef ScResArray *ScResPtr;
-
- typedef unsigned char String31[32];
- typedef String31 ScHalfToneArray[1];
- typedef ScHalfToneArray *ScHalfTonePtr;
-
-
- typedef struct {
- long reserved;
- short xDpi;
- short yDpi;
- Rect scanRect;
- short brightness;
- short contrast;
- char composition;
- char bitsPerPixel;
- short halfTone;
- } ScAreaRec;
-
- typedef struct {
- long reserved;
- short numAreas;
- ScAreaRec scanAreas[1];
- } ScScanAreaRec;
- typedef ScScanAreaRec *ScScanAreaPtr;
-
-
- /* Standard Routines */
-
- extern pascal short ScOpen(short *refNum);
- extern pascal short ScClose(short refNum);
- extern pascal short ScGetStdFeatures(short refNum,
- ScStdFeaturesPtr stdFeaturesPtr,
- short length);
- extern pascal short ScGetRes(short refNum, short compType,
- ScResPtr resPtr);
- extern pascal short ScGetHalfTones(short refNum, short compType,
- ScHalfTonePtr halfTonePtr);
- extern pascal short ScSetScanArea(short refNum,
- ScScanAreaPtr scanAreaPtr);
- extern pascal short ScDoScan(short refNum, char *buffer,
- long *count, short unused,
- short byteWidth, short rowBytes);
- extern pascal short ScAbortScan(short refNum);
-
-
- /* Advanced Constants */
-
- #define scLightDetail 0 /* GrayMap 0 */
- #define scNormalDetail 1 /* GrayMap 1 */
- #define scDarkDetail 2 /* GrayMap 2 */
-
- #define scSpeedNormal 0 /* NORMAL Speed, slow with handshaking */
- #define scSpeedHigh 1 /* HIGH Speed, fast with handshaking */
- #define scSpeedFast 2 /* FAST Speed, fast without handshaking */
-
- /* Apple (Vendor) Unique Param Type Constants */
-
- #define scUniqueUnpark 0 /* Unpark the the carriage */
- #define scUniquePark 1 /* Park the the carriage */
- #define scUniqueAbsPos 2 /* Abosolute carriage positioning */
- #define scUniqueRelPos 3 /* Relative carriage positioning */
- #define scUniqueSetID 4 /* Set Scanner Driver SCSI ID */
- #define scUniqueSetCRAM 5 /* Set CRAM Data (always 2550 bytes) */
- #define scUniqueGetCRAM 6 /* Get CRAM Data (always 2550 bytes) */
-
-
- /* Advanced Data Types */
-
-
- typedef struct {
- long reserved;
- short version;
- short secondaryMax;
- long downLoadFlags;
- long restrictFlags;
- long controlFlags;
- } ScAdvFeaturesRec;
- typedef ScAdvFeaturesRec *ScAdvFeaturesPtr;
-
- typedef struct {
- char xDimension;
- char yDimension;
- char patData[64];
- } ScPatRec;
- typedef ScPatRec *ScPatPtr;
-
- typedef struct {
- char RedGamma[256];
- char GreenGamma[256];
- char BlueGamma[256];
- }ScGammaTableRec;
- typedef ScGammaTableRec *ScGammaTablePtr;
-
- typedef struct{
- short matrix[9];
- }ScMatrix;
-
- typedef ScMatrix *ScMatrixPtr;
-
- /* Advanced Feature Flags */
-
- /* Download flags */
- #define sc2x2Matrix 0x00000001
- #define sc3x3Matrix 0x00000002
- #define sc4x4Matrix 0x00000004
- #define sc5x5Matrix 0x00000008
- #define sc6x6Matrix 0x00000010
- #define sc7x7Matrix 0x00000020
- #define sc8x8Matrix 0x00000040
-
- /* Restrict flags */
- #define scDiffXandYDPI 0x00000001
- #define scSecondArea 0x00000002
- #define scDiffXandYHT 0x00000004
-
- /* Control flags */
- #define scSetGroup3 0x00000001
- #define scSetGamma 0x00000002
- #define scSetThreshold 0x00000004
- #define scSetLampOn 0x00000008
- #define scSetNoHome 0x00000010
- #define scSetWait 0x00000020
- #define scSetSpeed 0x00000040
- #define scSetLed 0x00000080
- #define scGetButton 0x00000100
- #define scSetNoCal 0x00000200
- #define scLoadGamma 0x00000400
- #define scMatrixMul 0x00000800
- #define scInvert 0x00001000
- #define scSetAtoD 0x00002000
- #define scSensorSelect 0x00004000
-
- #define scAllSensors 0x00
- #define scRedSensor 0x01
- #define scGreenSensor 0x02
- #define scBlueSensor 0x03
-
- /* Advanced Routines */
-
- extern pascal short ScGetAdvFeatures(short refNum,
- ScAdvFeaturesPtr advFeaturesPtr,
- short length);
- extern pascal short ScSetHTPattern(short refNum, ScPatPtr patPtr);
- extern pascal short ScSetGroup3(short refNum, char compressOn);
- extern pascal short ScSetNoHome(short refNum, char noHome);
- extern pascal short ScSetLamp(short refNum, char lampOn);
- extern pascal short ScSetGrayMap(short refNum, short grayMap);
- extern pascal short ScSetThreshold(short refNum, short thesholdLevel);
- extern pascal short ScSetWaitButton(short refNum, char waitButton);
- extern pascal short ScSetSpeed(short refNum, short speed);
- extern pascal short ScSetLed(short refNum, char ledOn);
- extern pascal short ScResetButton(short refNum, char setTrue);
- extern pascal short ScGetButton(short refNum, Boolean *button);
- extern pascal short ScSetNoCal(short refNum, char noCalMode);
- extern pascal short ScVendorUnique(short refNum, short paramType, char *paramPtr);
- extern pascal short ScInvertPixels(short refNum, Boolean invert);
- extern pascal short ScSensorSelect(short refNum, short sensor);
- extern pascal short ScSetScannerAtoD(short refNum, char Vrt,char Vrb);
- extern pascal short ScLoadGamma(short refNum, ScGammaTablePtr gammaPtr);
- extern pascal short ScLoadMatrix(short refNum, ScMatrixPtr matrixPtr);
-
-
- /* Error Codes for Scanner */
-
-
- #define scNotFoundErr -17064 /* Scanner Not Found */
- #define scComErr -17065 /* Communication Error */
- #define scResetErr -17066 /* Scanner Reset */
- #define scParamErr -17067 /* Parameter or Command Error */
- #define scScannerErr -17068 /* Internal Scanner Malfunction */
- #define scLampErr -17069 /* Lamp malfunction */
- #define scEOS -17070 /* End Of Scan */
- #define scDimLampErr -17071 /* Lamp Getting Dim */
- #define scBusy -17072 /* Scanner Already scanning */